<template>
	<view class="container">
		<view class="list">
			<view class="item" v-for="(item,index) in courseList" :key="index" @click="toDetails(item)">
				<image :src="item.coverUrl" mode=""></image>
				<view class="text-cont">
					<view class="title">{{item.title}}</view>
					<view class="price">
						<view class="left"> <text>￥</text>{{item.voucher}}</view>
						<view class="right">购买</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { courseList } from '../../../api/api.js'
	export default {
		data() {
			return {
				courseList:[],
			};
		},
		onLoad() {
			this.getList()
		},
		methods:{
			getList(){
				let data = {}
				courseList(data).then(res=>{
					this.courseList = res.data.records
				})
			},
			toDetails(item){
				uni.navigateTo({
					url: '/pages/goods/goodsDetail?id=' + item.id + '&navId=' + this.navId +'&source=goods' + '&type=6' 
				})
			}
		}
	}
</script>

<style lang="less">
	page{
		background-color: #EFEFEF;
	}
	.container{
		padding: 45rpx 25rpx;
		.list{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			.item{
				width: 342rpx;
				background-color: #fff;
				border-radius: 30rpx;
				overflow: hidden;
				margin-bottom: 20rpx;
				image{
					width: 100%;
					height: 342rpx;
				}
				.text-cont{
					padding: 14rpx;
					.title{
						font-weight: 400;
						font-size: 26rpx;
						color: #333333;
						line-height: 37rpx;
					}
					.price{
						margin-top: 10rpx;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.left{
							font-weight: 500;
							font-size: 34rpx;
							color: #02C538;
							text{
								font-size: 20rpx;
								color: #02C538;
							}
						}
						.right{
							    width: 49px;
							    height: 18px;
							    line-height: 18px;
							    background: #95E07E;
							    border-radius: 20px 20px 20px 20px;
							    font-family: PingFang SC, PingFang SC;
							    font-weight: 500;
							    font-size: 12px;
							    color: #FFFFFF;
								text-align: center;
						}
					}
				}
				
			}
		}
	}
</style>
